import $http from './ajax'
export const checkLogin =()=>$http('./api/user/get_user_info.do');
export const categoryData = () => $http('/category/data');

// 请求数据渲染
export const hotData =()=>$http('/search/hot');

// 通过商品名搜索
export const  productListKeyword=(params)=>$http('/api/product/list.do',{
  keyword:params.keyword,
  pageNum:params.pageNum,
  pageSize: params.pageSize,
  orderBy:params.orderBy
});
// 通过商品类别搜索
export const  productListCategoryId=(params)=>$http('/api/product/list.do',{
  categoryId:params.categoryId,
  pageNum:params.pageNum,
  pageSize: params.pageSize,
  orderBy:params.orderBy
});

// 商品详情数据请求
export const productDetail=(productId)=>$http('/api/product/detail.do',{
  productId
})

// 调用登录接口
export const userLogin=(username,password)=>$http('/api/user/login.do',{
  username,
  password
})

// 注册
export const userRegister = (params) => $http('/api/user/register.do', {
  username: params.username,
  password: params.password,
  email: params.email,
  phone: params.phone,
  question: params.question,
  answer: params.answer
});
